 



import UIKit

 class DFUStartViewController: UIViewController {
    
    @IBOutlet private var connectButton: NordicButton!
    @IBOutlet private var accessoriesButton: NordicButton!
    
    private let router: DFURouterType
    
    init(router: DFURouterType) {
        self.router = router
        super.init(nibName: "DFUStartViewController", bundle: .main)
    }
    
    
    override init(nibName: String?, bundle: Bundle?){
        self.router = DFURouter.init(navigationController: UINavigationController.init())
        super.init(nibName: nibName, bundle: bundle)
    }
    
    required  init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
     override func viewDidLoad() {
        super.viewDidLoad()
        navigationItem.title = "DFU"
        
        connectButton.style = .mainAction
        accessoriesButton.style = .mainAction
    }
//MARK: -------- 连接蓝牙 ----------
    @IBAction  @objc func openBluetoothConnector() {
        //连接蓝牙
        let scanner = PeripheralScanner(services: [])
//        scanner.dfu_name = "Holyiot-DFU"
        scanner.dfu_name = BluetoothCenter.shareInstance().dfu_name
        router.goToBluetoothConnector(scanner: scanner, presentationType: .push) { [weak self] (p) in
            //连接成功后选择文件
            self?.router.goToFileSelection()
        }
    }
    
    @IBAction func openHomeAccessory() {
      
    }
}

